
# print(sum(1,2,3,4))print(sum(1,2,3,4))  # TypeError: sum() takes at most 2 arguments (4 given)

# print(sum([1,2,3,4,5,6])) # 21


# with open('aaa', mode='rt',encoding='utf-8') as f:
#     g =(len(line) for line in f)
#     print(g)  # 得到了一个可迭代对象，<generator object <genexpr> at 0x0000022A97EB45F0>
#     res = sum(g)
#     print(res)

'''错误案例：无元组表达式，小括号是生成器表达式'''
g = (i for i in range(1,10)) # 等价于 g = (元组.append(i) for i in range(1,10))
print(g)  # <generator object <genexpr> at 0x0000013BD06145F0>